package com.senthink.gl.business.api.controller;

import com.senthink.gl.business.common.entity.PageDto;
import com.senthink.gl.business.common.entity.SearchRequest;
import com.senthink.gl.business.common.entity.TimeSearchRequest;
import com.senthink.gl.business.userlog.UserLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 操作日志Controller
 * @author yuanpeng@senthink.com
 * @data 2018-02-01 14:02
 */
@Api(tags = "操作日志Controller")
@RestController
public class UserLogController {

    @Autowired
    private UserLogService service;

    @ApiOperation(notes = "操作日志列表",value = "操作日志列表")
    @RequestMapping(value = "${uri.userLog.userLogs}", method = RequestMethod.GET)
    public ResponseEntity<?> findAll(String role, String operate, TimeSearchRequest timeSearchRequest, SearchRequest searchRequest, @Validated PageDto pageDto) {
        return ResponseEntity.ok(service.findAll(role, operate, timeSearchRequest, searchRequest, pageDto));
    }

    @ApiOperation(notes = "获取操作类型列表",value = "获取操作类型列表")
    @RequestMapping(value = "${uri.userLog.operate}", method = RequestMethod.GET)
    public ResponseEntity<?> operate() {
        return ResponseEntity.ok(service.operate());
    }

}
